#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long

const int N=1e5+10;

int n,r[N],rr[N];
int f[N],cnt,fu,ff[N],zj;

void sol(int x){
    while(x){
        while(f[rr[zj]]==0)zj++;
        if(f[rr[zj]]<x){
            x-=f[rr[zj]];
            f[rr[zj]]=0;
        }else{
            f[rr[zj]]-=x;
            x=0;
        }
    }
}

signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>r[i];
        f[r[i]]++;
        ff[r[i]]++;
    }
    sort(r+1,r+1+n);
    for(int i=1;i<=n;i++)rr[i]=r[i];
    int k=unique(rr+1,rr+1+n)-rr-1;
    int tmp=n-f[rr[1]],cnt=0;
    //cout<<tmp<<' '<<ff[rr[1]]<<'\n';
    for(int i=1;i<=k;i++){
        if(tmp==0)break;
        cnt+=min(tmp,ff[rr[i]]);
        zj=max(zj,i+1);
        int tempp=ff[rr[i]];
        sol(min(tmp,ff[rr[i]]));
        tmp-=min(tmp,tempp);
        tmp-=f[rr[i+1]];
    }
    cout<<n-cnt;
    return 0;
}
